<?php $this->load->view('admin_home/_header') ?>
<?php $this->load->view('message') ?>
<head>
<script type="text/javascript">
  $().ready(function(){
    $("#module_li").addClass("active"); 

 	$('.selectpicker').selectpicker({});


	$("#relative_test_points_select").selectpicker('val',[
<?php foreach ($relative_test_points as $item ): ?>
<?=$item['id']?>,
<?php endforeach ?>
		0]);						


		
    $("#module_edit_form").validate({
		rules:{
			module_name:
			{
				required:true,
				maxlength:200
			}
		}
	});   
  });
</script>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    </head>
<div class="container">
	<div class="panel panel-primary">
		<div class="panel-heading">
			<h3 class="panel-title">编辑模块</h3>
		</div>
		<div class="panel-body">
			<?php echo validation_errors(); ?>
			<form id="module_edit_form" method="post" class="form-horizontal"  enctype="multipart/form-data" action="<?php echo site_url('admin_module/edit')?>
				" >
				<input type="text" id="module_type" name="module_type" value="0
				" class="hidden">
				<input type="text" id="module_id" name="module_id" value="<?=$module['id']?>
				" class="hidden">
				<fieldset>
					<div class="form-group">
						<label class="col-lg-2 control-label">名称:</label>
						<div class="col-lg-8">
							<input class="form-control" id="module_name" name="module_name" value="<?=$module['name']?>"/></div>

					</div>
					<div class="form-group">
						<label class="col-lg-2 control-label">考试时间:</label>
						<div class="col-lg-8">
							<select class="form-control" name="module_time_limit" id="module_time_limit">
								<?php for($i=5; $i<=100 ;$i+=5) :?>
								<option value="<?=$i?>"
									<?php if($i==$module['time_limit']) echo "selected='true'"?>
								>
									<?=$i?>分钟</option>
								<?php endfor; ?></select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-lg-2 control-label">相关课程:</label>
						<div class="col-lg-8">
							<select class="form-control" name="big_lecture_id" id="big_lecture_id">
								<option value="">--相关课程--</option>
								<?php foreach ($big_lectures as $item) :?>
									<option value="<?=$item['id']?>" <?php echo ($item['id'] == $module['big_lecture_id'])?'selected="selected"':'' ?>>
										<?=$item['name']?>
									</option>
								<?php endforeach; ?>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-lg-2 control-label">相关考点:</label>
						<div class="col-lg-8">

							<select id="relative_test_points_select" class="selectpicker form-control" multiple data-live-search="true" data-style="btn-primary" multiple data-selected-text-format="count" name="relative_test_points[]">
								<?php foreach ($test_points as $item ): ?>
								<option value="<?=$item['id']?>">
									<?=$item['content']?></option>
								<?php endforeach ?>
							</select>

						</div>
					</div>
					
					<div class="form-group">
						<label class="col-lg-2 control-label"></label>
						<div class="col-lg-8">
							<?php foreach ($relative_test_points as $item ): ?>
								<?=$item['content']?> <br />
							<?php endforeach ?>
						</div>
					</div>

					<div class="form-group">
						<div class="col-lg-10 col-lg-offset-2">
							<button type="submit" class="btn btn-primary">提交</button>
						</div>
					</div>
				</fieldset>
			</form>
		</div>
	</div>
</div>

<?php $this->load->view('admin_home/_footer')?>